package dungeonDigger.entities;

import java.util.HashMap;

import dungeonDigger.enums.DamageType;

public class DamageTypeMatrix {
	public static DamageTypeMatrix		DEFAULT	= new DamageTypeMatrix( new DamageType[] { DamageType.NORMAL }, new float[] { 100 } );
	private HashMap<DamageType, Float>	matrix	= new HashMap<DamageType, Float>();

	/** @param types DamageType Enums
	 * @param values Percentages i.e. - .25, .60, .15, .05 */
	public DamageTypeMatrix(DamageType[] types, float[] values) {
		if( types.length != values.length ) { throw new IllegalArgumentException( "Length of types and values must be the same!" ); }
		float total = 0;
		for( float f : values ) {
			total += f;
		}
		for( int i = 0; i < types.length; i++ ) {
			matrix.put( types[i], values[i] );
		}
		if( total < 1 ) {
			matrix.put( DamageType.NORMAL, 1 - total );
		}
	}

	public HashMap<DamageType, Float> getMatrix() {
		return this.matrix;
	}
}
